﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Business.Util;
using ZLCMS.Commands.User.Commands.User;
using DotNet.Common.Command;
using ZLCMS.Business.DwzFrame;

namespace ZLCMS.Web.SystemManage.Basics.RightConfig.User
{
    public partial class ChangePassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            //页面控件值
            if (!IsPostBack)
            {
                lb_account.Text = UserKit.GetUserAccount();
            }
            else
            {
                //初始化DWZ控件
                FrameHelper _framePage = new FrameHelper(this);
                ICommandResult<ModifyPasswordResult> result = new ModifyPasswordCommand().Execute(new ModifyPasswordParameter() { UserAccount = UserKit.GetUserAccount(), NewPassword = tb_password_1.Text, OldPassword = tb_password_old.Text });
                if (!result.Error)
                {
                    _framePage.Alert(new ReturnCode()
                    {
                        statusCode = 200,
                        message = "操作成功!",
                        callbackType = "closeCurrent"
                    });

                }
                else
                {

                    _framePage.Alert(new ReturnCode() { statusCode = 300, message = result.ErrorMsg });
                }
            }
        }
    }
}